<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">质检入库详情</h3>
    </div>
    <div class="panel-body">
        <!-- 基本信息 -->
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-sm-4">小工单计划编码:</label>
                    <div class="col-sm-8">
                        <p class="form-control-static">{$inventory.allocation.plan.plan_code|default='--'}</p>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-sm-4">订单名称:</label>
                    <div class="col-sm-8">
                        <p class="form-control-static">{$inventory.allocation.order.order_name|default='--'}</p>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row">
            <div class="col-md-6">
            <div class="form-group">
                <label class="control-label col-sm-4">产品型号:</label>
                <div class="col-sm-8">
                    <p class="form-control-static">{$inventory.productModel.name|default='--'}</p>
                </div>
            </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-sm-4">工序:</label>
                    <div class="col-sm-8">
                        <p class="form-control-static">{$inventory.process.name|default='--'}</p>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-sm-4">报工员:</label>
                    <div class="col-sm-8">
                        <p class="form-control-static">{$inventory.user.nickname|default='--'}</p>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-sm-4">质检员:</label>
                    <div class="col-sm-8">
                        <p class="form-control-static">{$inventory.qualityUser.nickname|default='--'}</p>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 质检数量信息 -->
        <div class="row">
            <div class="col-md-4">
                <div class="form-group">
                    <label class="control-label col-sm-6">质检数量:</label>
                    <div class="col-sm-6">
                        <p class="form-control-static"><strong class="text-primary">{$inventory.quantity}</strong></p>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="form-group">
                    <label class="control-label col-sm-6">合格数量:</label>
                    <div class="col-sm-6">
                        <p class="form-control-static"><strong class="text-success">{$inventory.qualified_quantity}</strong></p>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="form-group">
                    <label class="control-label col-sm-6">不合格数量:</label>
                    <div class="col-sm-6">
                        <p class="form-control-static"><strong class="text-danger">{$inventory.unqualified_quantity}</strong></p>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-sm-4">质检结果:</label>
                    <div class="col-sm-8">
                        <p class="form-control-static">
                            {if $inventory.quality_result == 1}
                            <span class="label label-success">合格</span>
                            {else/}
                            <span class="label label-danger">不合格</span>
                            {/if}
                        </p>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-sm-4">处理方式:</label>
                    <div class="col-sm-8">
                        <p class="form-control-static">
                            {switch $inventory.handle_method}
                            {case 1}<span class="label label-success">合格</span>{/case}
                            {case 2}<span class="label label-warning">返工</span>{/case}
                            {case 3}<span class="label label-info">让步接收</span>{/case}
                            {case 4}<span class="label label-danger">报废</span>{/case}
                            {default/}<span class="label label-default">--</span>
                            {/switch}
                        </p>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-sm-4">入库状态:</label>
                    <div class="col-sm-8">
                        <p class="form-control-static">
                            {if $inventory.inventory_status == 1}
                            <span class="label label-success">已入库</span>
                            {else/}
                            <span class="label label-warning">待入库</span>
                            {/if}
                        </p>
                    </div>
                </div>
            </div>
            {if $inventory.inventory_status == 1}
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-sm-4">入库操作员:</label>
                    <div class="col-sm-8">
                        <p class="form-control-static">{$inventory.inventoryUser.nickname|default='--'}</p>
                    </div>
                </div>
            </div>
            {/if}
        </div>
        
        <!-- 检查结果 -->
        {if !empty($checkResults)}
        <div class="form-group">
            <label class="control-label col-sm-2">检查结果:</label>
            <div class="col-sm-10">
                <table class="table table-bordered table-condensed">
                    <thead>
                        <tr>
                            <th width="30%">检查类别</th>
                            <th width="40%">检查项目</th>
                            <th width="30%">检查结果</th>
                        </tr>
                    </thead>
                    <tbody>
                        {foreach $checkResults as $categoryName => $items}
                        {foreach $items as $itemName => $result}
                        <tr>
                            <td>{$categoryName}</td>
                            <td>{$itemName}</td>
                            <td>
                                {if $result == '合格' || $result == 'qualified'}
                                <span class="label label-success">合格</span>
                                {elseif $result == '无' /}
                                <span class="label label-info">无</span>
                                {elseif $result == '不合格' /}
                                <span class="label label-danger">不合格</span>
                                {else /}
                                {$result}
                                {/if}
                            </td>
                        </tr>
                        {/foreach}
                        {/foreach}
                    </tbody>
                </table>
            </div>
        </div>
        {/if}
        
        <!-- 质检备注 -->
        {if !empty($inventory.quality_remark)}
        <div class="form-group">
            <label class="control-label col-sm-2">质检备注:</label>
            <div class="col-sm-10">
                <p class="form-control-static">{$inventory.quality_remark}</p>
            </div>
        </div>
        {/if}
        
        <!-- 时间信息 -->
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-sm-4">质检时间:</label>
                    <div class="col-sm-8">
                        <p class="form-control-static">{$inventory.check_time|date='Y-m-d H:i:s',###}</p>
                    </div>
                </div>
            </div>
            {if $inventory.inventory_time}
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-sm-4">入库时间:</label>
                    <div class="col-sm-8">
                        <p class="form-control-static">{$inventory.inventory_time|date='Y-m-d H:i:s',###}</p>
                    </div>
                </div>
            </div>
            {/if}
        </div>
    </div>
</div>
